const {
	Controller
} = require('uni-cloud-router')

module.exports = class TypesController extends Controller {
	// const { ctx, service } = this // 可以从实例中获取上下文和sevice
	async remove() {
		// 删除类型
		const db = uniCloud.database();
		// 获取 `project-type` 集合的引用
		const collection = db.collection('project-type');
		const {
			id
		} = this.ctx.data
		collection.where({
			_id: id
		}).remove().then((res) => {
        console.log("删除成功，删除条数为: ",res.deleted);
				return "删除成功"
    })
    .catch((err) => {
        console.log( err.message )
				return "删除失败"
    })
	}

}
